package com.briup.day07;

/**
 * @author lining
 * @date 2024/1/16 16:02
 */
public class Teacher {
    public Teacher() {
        System.out.println("执行无参构造器");
    }


    //属性
    private int id;
    private String name;

    private double salary = gettid();//直接赋值
    //静态属性
    public static String school = geName();

    //代码块
    static{
        System.out.println("执行静态代码块");
        school = "希望小学";
    }
    {
        //由位置绝定  非静态属性显示赋值和 代码块值值顺序
        System.out.println("执行非静态代码块");
        this.salary = 3500;
    }
    public static String geName(){
        System.out.println("静态属性的显式赋值");
        return "希望中学";
    }
    public int gettid(){
        System.out.println("非静态属性的显式赋值");
        return 1;
    }




    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
